#include "raft/node.h"

int main() {
  std::vector<libraft::RaftNode*> rafts;
  libraft::Options options1(
      "127.0.0.1:8901,127.0.0.1:8902,127.0.0.1:8903,127.0.0.1:8904,127.0.0.1:"
      "8905",
      "127.0.0.1", 8901, "data1", "meta1", "log1");
  libraft::RaftNode raft_node1(options1);
  std::shared_ptr<libraft::Raft> raft1 =
      raft_node1.StartNode("raft_example4/");

  while (1) {
    if (raft1->HasLeader()) {
      std::string server_status;
      raft_1->GetServerStatus(&server_status);
      LOG_INFO << server_status;

      for (int j = 0; j < 2000; j++) {
        rocksdb::Status s = raft1->Write(std::to_string(i), std::to_string(i));

        assert(s.ok());
        std::string value;
        s = raft1->Read(std::to_string(i), &value);
        assert(s.ok());
        assert(std::to_string(i) == value);
      }
    }
  }
}
